package com.study.design.pattern.pattern.behavioral.mediator;

/**
 * @Author: gongsl
 * @Date: 2025-03-25 21:49
 */
public class MediatorPatternTest {
    public static void main(String[] args) {
        ChatMediator chatRoom = new ChatRoom();
        User user1 = new ChatUser(chatRoom, "阿猫");
        User user2 = new ChatUser(chatRoom, "阿狗");
        User user3 = new ChatUser(chatRoom, "阿祥");

        chatRoom.addUser(user1);
        chatRoom.addUser(user2);
        chatRoom.addUser(user3);

        user1.sendMessage("大家好！我是" + user1.getName());
        System.out.println("-----------分割线-----------");
        user2.sendMessage("你好啊，我是" + user2.getName());
    }
}
